package com.bytech.common.config;

import java.util.Date;

import com.bytech.common.utils.DateUtils;

/**
 * @Author zhao
 * @Create 2021/7/2813:24
 */
public class AppGlobalConstants {

    // 博客管理员ID
    public static final String BLOG_ADMIN_USER_ID = "a1f33e8eeaf747b8bd7ca81a780abf3c";

    public static final String BLOG_PASSWORD_KEY = "27a68732497d487baf4c6d7f2fa6b9a9";

    // 虚假的博客上线时间~
    public static final Date BLOG_ONLINE_DATE = DateUtils.strToDate("2021-01-01 00:00:00", DateUtils.DateTimeFormat);

    // cookie
    public static final String BLOG_USER_COOKIE_KEY = "BTAT";
    public static final Integer BLOG_USER_COOKIE_EXPIRED = 60 * 60 * 24 * 7; // 7天
    // session
    public static final String BLOG_USER_SESSION_KEY = "BTUserSession";
    public static final Integer BLOG_USER_SESSION_EXPIRED = 60 * 10;

    // redis中的用户信息副本
    public static final String BLOG_USER_TOKEN_REDIS_KEY = "auth:token:user:%s";

    // redis 中存储的路由配置的key
    public static final String GATEWAY_ROUTES_KEY = "gateway:routes";

    // 网关暴露的触发手动更新的接口
    public static final String GATEWAY_ROUTE_MANUAL_UPDATE_URL = "/gateway/route/manualUpdate";

    public static final Integer ARTICLE_SUMMARY_LENGTH = 60;

    /**
     * 通过token返回redis中的键值
     */
    public static String getTokenRedisKey(String token) {
        return String.format(BLOG_USER_TOKEN_REDIS_KEY, token);
    }

    public static final String COMMENT_SEPARATOR_STR = "/";

    public static final String EMOTICON_REG_START_STR = "#@";
    public static final String EMOTICON_REG_END_STR = "@#";
    public static final String EMOTICON_TAG_FORMAT = "<img class=\"emoticon\" src=\"{0}\"/>";
}
